package cairmgon.commands
{
	import cairmgon.business.HelloWorldDelegate;
	import cairmgon.events.SayHelloWorldEvent;
	
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import util.ModleUtil;
	
	public class SayHelloCommand implements ICommand, IResponder
	{
		
		public function execute(event:CairngormEvent):void
		{
			var sayHelloEvent:SayHelloWorldEvent = event as SayHelloWorldEvent;
			var helloDelegate:HelloWorldDelegate = new HelloWorldDelegate(this);
			helloDelegate.sayHello(sayHelloEvent.myName);
		}
		
		public function result(data:Object):void
		{
			Alert.show(data.result as String);
			ModleUtil.getOneSingleModleUtil().showWords = data.result as String;
		}
		
		public function fault(info:Object):void
		{
			Alert.show(info.toString());
		}
	}
}